package com.lagou.mapper;

import com.lagou.entity.TbItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author qjc
 * @since 2021-12-21
 */
public interface TbItemMapper extends BaseMapper<TbItem> {

    @Update("update tb_item set count=count-1 where id=#{itemId}")
    void decrCountById(@Param("itemId") Long itemId);

    @Update("update tb_item set count=count+#{count} where id=#{itemId}")
    void incrCountById(@Param("itemId") Long itemId, @Param("count") Integer count);
}
